#define __key_c

#include    "includeAll.h"

void GetKey()
{
    
    static uint8_t index=0;
    
    for(index=0;index<D_keyCount;index++){
        if(backUp[index]!=keySta[index])
        {
            if(backUp[index]!=0)
            {
                keyValue=index+1;
            }
        backUp[index]=keySta[index];
        }
    }
}

void KeyJudge()
{
    static uint8_t index;
    
    keyBuf[0]=(keyBuf[0]<<1)|P_key1;
    keyBuf[1]=(keyBuf[1]<<1)|P_key2;
    keyBuf[2]=(keyBuf[2]<<1)|P_key3;
    keyBuf[3]=(keyBuf[3]<<1)|P_key4;
    keyBuf[4]=(keyBuf[4]<<1)|P_key5;
    
    for(index=0;index<D_keyCount;index++)
    {
        if((keyBuf[index]&0x0f)==0)
        {
            keySta[index]=0;
        }
        else if((keyBuf[index]&0x0f)==0x0f)
        {
            keySta[index]=1;
        }
    }
}